#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
map<int, int> mp;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin >> n;
	for (int i = 0; i < 2 * n; i++) {
		int x; cin >> x;
		mp[x]++;
	}
	for (auto i : mp) {
		if (i.second & 1) {
			cout << -1 << endl;
			return 0;
		}
	}
	vector<int> v;
	for (auto i : mp) {
		int cnt = i.second / 2;
		while (cnt--) {
			v.push_back(i.first);
		}
	}
	for (int i = 0; i < 2; i++) {
		for (auto x : v) cout << x << " ";
		cout << endl;
	}
	return 0;
}